import { request } from '../utils/request';
import { removeToken } from './token';
const login = async (
  account: string,
  password: string
): Promise<ApiResponse> => {
  const url = `/login/login`;
  const params = {
    account,
    password,
  };
  const response = await request.post(url, params);
  return response;
};

const loginout = (): void => {
  removeToken();
};

const checkLogin = async (): Promise<ApiResponse> => {
  const res = await request.get('/login/checkLogin');
  return res;
};

export { login, loginout, checkLogin };
